package com.sop.model;
// Generated 2016-12-19 13:00:56 by Hibernate Tools 4.0.0

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.ForeignKey;

/**
 * PeopleInfo generated by hbm2java
 */
@Entity
@Table(name = "people_info", catalog = "sop")
public class PeopleInfo implements java.io.Serializable{

	private Integer id;
	private String name;
	private String account;
	private String password;
	private String phone;
	private String email;
	private OrganizationalInfo department;
	private Integer state;
	
	private List<RoleInfo>  roleInfos;//人员对应的角色集合

	public PeopleInfo() {
	}

	public PeopleInfo(Integer id) {
		this.id = id;
	}

	public PeopleInfo(Integer id, String name, String account, String password,
			String phone, String email, Integer department, Integer state) {
		this.id = id;
		this.name = name;
		this.account = account;
		this.password = password;
		this.phone = phone;
		this.email = email;
		this.department = new OrganizationalInfo();
		this.department.setId(department);
		this.state = state;
	}

	@Id
	@Column(name = "id", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "account", length = 50)
	public String getAccount() {
		return this.account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	@Column(name = "password", length = 50)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "phone", length = 50)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "email", length = 50)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@ManyToOne
    @JoinColumn(name="department")
	@ForeignKey(name="null")
	public OrganizationalInfo getDepartment() {
		return department;
	}

	public void setDepartment(OrganizationalInfo department) {
		this.department = department;
	}

	@Column(name = "state")
	public Integer getState() {
		return this.state;
	}

	

	public void setState(Integer state) {
		this.state = state;
	}

	@Transient
	public List<RoleInfo> getRoleInfos() {
		return roleInfos;
	}

	public void setRoleInfos(List<RoleInfo> roleInfos) {
		this.roleInfos = roleInfos;
	}

}
